package com.zsrt.bbu.bank.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zsrt.bbu.bank.service.BankService;
import com.zsrt.bbu.bank.service.impl.BankServiceImpl;
import com.zsrt.utils.GsonUtil;

public class BankController  extends HttpServlet{
	
	private static final long serialVersionUID = 7360423272684888874L;
	
	
	private BankService service  = new BankServiceImpl();
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		String method = request.getParameter("method");
		//1调用service层的方法  要准备1个袋子map用来拿service层返回的结果..
		Map<String, Object> map  = new HashMap<String, Object>();
		
		//2调用各种业务方法 crud
		if("findAll".equals(method)){
			service.findAll(map);
		}
		
		//3 把最终的结果以json格式返回给前台页面
		GsonUtil.printJson(response, map);
		
		
	}

}
